package com.atguigu.h_deamon;

public class Demo {
    public static void main(String[] args) {
        //小明线程
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i <= 10000; i++) {
                    System.out.println(Thread.currentThread().getName() + " 燕子, 没有你我怎么活 !! " + i);
                }
            }
        }, "小明 :");
        //女神线程
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i <= 10; i++) {
                    System.out.println(Thread.currentThread().getName() + " 你哪位 ? 她在洗澡 ! " + i);
                }
            }
        }, "燕子 :");

        t1.setDaemon(true);//把小明线程设置为守护线程

        t1.start();
        t2.start();
        //main线程到这里就执行完毕了!
    }
}
